package com.shu.action;

import java.util.List;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts2.ServletActionContext;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;

import com.opensymphony.xwork2.Action;
import com.shu.entity.Student;
import com.shu.service.StudentService;

@Controller
public class findMaxScoreAction {
	@Autowired
	private StudentService studentService;
	
	private String course;
	private int score;
	
	public String execute() {
		HttpServletRequest request = ServletActionContext.getRequest();
		System.out.println(course+","+score);
	 	/*float stuMaxScore=studentService.findMaxByCourse(course);
		request.setAttribute("scorekey", stuMaxScore);*/
		List<Student> studentList = studentService.findMaxByCourseList(course);
		request.setAttribute("scorekeylist", studentList);
		return Action.SUCCESS;
		
	}
	public String getCourse() {
		return course;
	}
	public void setCourse(String course) {
		this.course = course;
	}
	public int getScore() {
		return score;
	}
	public void setScore(int score) {
		this.score = score;
	}

	
}
